<?
if ( ($_REQUEST['jenis_dokumen'] == '1') || ($_REQUEST['jenis_dokumen'] == '2')) {
	$editable_hash['master_profil_tarikh_lahir'] = "readonly style=\"background-color:#cecece\"";
	
	$editable_hash['master_profile_agama_id'] = 'readonly onfocus="this.blur()" style="background-color:#cecece"';
	// Gmi edited 17/02/2011 requested by HISHAM
	//$editable_hash['master_profile_kod_kaum'] = 'readonly onfocus="this.blur()" style="background-color:#cecece"';
	// bapa 
	$editable_hash['profile_bapa_nama'] = "readonly  style=\"background-color:#cecece\"";
	$editable_hash['profile_bapa_no_kp'] = "readonly style=\"background-color:#cecece\"";
	$editable_hash['profile_bapa_warganegara_id'] = "";
	// ibu                
	$editable_hash['profile_ibu_nama'] = "readonly style=\"background-color:#cecece\"";
	$editable_hash['profile_ibu_no_kp'] = "readonly style=\"background-color:#cecece\"";
	$editable_hash['profile_ibu_warganegara_id'] = "";
}else{
	$editable_hash['master_profil_tarikh_lahir'] = "readonly";
}
?>
<fieldset style="background:#ffffff; border-width:thin; border-style:solid; padding:10px; border-color:#CCCCCC;">
<legend style="font-size:1.0em; font-weight: bold;">Maklumat Peribadi </legend>
<table width="100%" cellspacing="1" cellpadding="2" border="0" class="classBackground">
  <tbody>
    <tr>
      <td width="20" align="left" valign="top" class="color_606060">&nbsp;</td>
      <td width="30%" align="left" valign="top">No Ahli </td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="ahli[no_ahli]" id="no_ahli" value="<?=$ahli->no_ahli?>" onblur="" onchange="" onfocus="" onselect="" maxlength="12" size="12" type="text"/>
      </span><span style="color:orange">&nbsp;No Ahli Terkini: <?=get_latest_no_ahli();?></span>&nbsp;&nbsp;[<a href='javascript:b()'>No Ahli Belum Diguna</a>]</td>
    </tr>
	<script>
	function b() {
		MM_openBrWindow('?act=popup_no_ahli_blm_guna','','scrollbars=yes,width=800,height=600')
	}
	</script>
    <tr>
      <td width="20" align="left" valign="top" class="color_606060">&nbsp;</td>
      <td width="30%" align="left" valign="top">Nama</td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="ahli[nama_ahli]" id="nama_ahli" value="<?=$ahli->nama_ahli?>" onblur="" onchange="this.value=this.value.toUpperCase()" onfocus="" onselect="" maxlength="100" size="50" type="text"/>
      </span></td>
    </tr>
    <tr>
      <td width="20" align="left" valign="top" class="color_606060">&nbsp;</td>
      <td width="30%" align="left" valign="top">No. KP Baru </td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="ahli[nokp_baru]" id="nokp_baru" value="<?=$ahli->nokp_baru?>" onblur="" onchange="" onfocus="" onselect="" maxlength="14" size="14" type="text"/>
      </span></td>
    </tr>
    <tr>
      <td width="20" align="left" valign="top" class="color_606060">&nbsp;</td>
      <td width="30%" align="left" valign="top">No. KP Lama </td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="ahli[nokp_lama]" id="nokp_lama" value="<?=$ahli->nokp_lama?>" onblur="" onchange="" onfocus="" onselect="" maxlength="12" size="14" type="text"/>
      </span></td>
    </tr>
    <tr>
      <td valign="top" align="left" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">Keahlian</td>
      <td width="30">:</td>
      <td><span class="classRow">
        <select name="pribadi[keahlian]" id="keahlian" onchange="">
          <?
				$default_keahlian = ($pribadi->keahlian) ? $pribadi->keahlian : 'Aktif';
				$combo   = new GUI();
				//$options = getOptionsFromTable('ref_negeri','id','negeri');
				$options = getOptionsFromTable('status_keahlian','status','status');
				echo $combo->printCombo2($options, "",true, $default_keahlian, false,0);
			  ?>
        </select>
      </span></td>
    </tr>
    <tr>
      <td width="20" align="left" valign="top" class="color_606060">&nbsp;</td>
      <td width="30%" align="left" valign="top">Tarikh Masuk </td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="ahli[tarikh_masuk]" id="tarikh_masuk" value="<?=dmy_date($ahli->tarikh_masuk)?>" onblur="" onchange="" onselect="" maxlength="12" size="12" type="text" readonly="readonly" onfocus="alert('Sila klik pada (dd-mm-yyyy) di sebelah')"/>
        <span style=" font-size:0.8em; color: orange;">(<a id="f_rangeStart_trigger">dd-mm-yyyy</a>)</span>
        <!--button id="f_clearRangeStart" onclick="clearRangeStart()">clear</button-->
        <script type="text/javascript">
                  new Calendar({
                          inputField: "tarikh_masuk",
                          dateFormat: "%d-%m-%Y",
                          trigger: "f_rangeStart_trigger",
                          bottomBar: false,
                          onSelect: function() {
                                  var date = Calendar.intToDate(this.selection.get());
                                  LEFT_CAL.args.min = date;
                                  LEFT_CAL.redraw();
                                  this.hide();
                          }
                  });
                  function clearRangeStart() {
                          document.getElementById("tarikh_masuk").value = "";
                          LEFT_CAL.args.min = null;
                          LEFT_CAL.redraw();
                  };
                </script>
</span></td>
    </tr>
    <tr>
      <td width="20" align="left" valign="top" class="color_606060">&nbsp;</td>
      <td width="30%" align="left" valign="top">Tarikh Berhenti </td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="ahli[tarikh_berhenti]" id="tarikh_berhenti" value="<?=dmy_date($ahli->tarikh_berhenti)?>" onblur="" onchange="" onselect="" maxlength="12" size="12" type="text" readonly="readonly" onfocus="alert('Sila klik pada (dd-mm-yyyy) di sebelah')"/>
        <span style=" font-size:0.8em; color: orange;">(<a id="tarikh_berhenti_trigger">dd-mm-yyyy</a>)</span>
        <!--button id="f_clearRangeStart" onclick="clearRangeStart()">clear</button-->
        <script type="text/javascript">
                  new Calendar({
                          inputField: "tarikh_berhenti",
                          dateFormat: "%d-%m-%Y",
                          trigger: "tarikh_berhenti_trigger",
                          bottomBar: false,
                          onSelect: function() {
                                  var date = Calendar.intToDate(this.selection.get());
                                  LEFT_CAL.args.min = date;
                                  LEFT_CAL.redraw();
                                  this.hide();
                          }
                  });
                  function clearRangeStart() {
                          document.getElementById("tarikh_berhenti").value = "";
                          LEFT_CAL.args.min = null;
                          LEFT_CAL.redraw();
                  };
                </script>
</span></td>
    </tr>
    <tr>
      <td width="20" align="left" valign="top" class="color_606060">&nbsp;</td>
      <td width="30%" align="left" valign="top">Sebab Berhenti </td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="ahli[sebab_berhenti]" id="sebab_berhenti" value="<?=$ahli->sebab_berhenti?>" onblur="" onchange="" onfocus="" onselect="" maxlength="100" size="50" type="text"/>
      </span></td>
    </tr>
    <tr>
      <td align="left" valign="top" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">Ahli Insuran </td>
      <td width="30">:</td>
      <td><span class="classRow">
        <select name="ahli[ahli_insuran]" id="ahli_insuran" onchange="">
          <?
				$default_ahli_insuran = ($ahli->ahli_insuran) ? $ahli->ahli_insuran : 0;
				$combo   = new GUI();
				//$options = getOptionsFromTable('ref_negeri','id','negeri');
				$options = array("Tidak"=>"0","Ya"=>"1");
				echo $combo->printCombo2($options, "",true, $default_ahli_insuran, false,0);
			  ?>
        </select>
      </span></td>
    </tr>
    <tr>
      <td align="left" valign="top" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">Ahli AIA </td>
      <td width="30">:</td>
      <td><span class="classRow">
        <select name="ahli[ahli_aia]" id="ahli_aia" onchange="">
          <?
				$default_ahli_aia = ($ahli->ahli_aia) ? $ahli->ahli_aia : 0;
				$combo   = new GUI();
				//$options = getOptionsFromTable('ref_negeri','id','negeri');
				$options = array("Tidak"=>"0","Ya"=>"1");
				echo $combo->printCombo2($options, "",true, $default_ahli_aia, false,0);
			  ?>
        </select>
      </span></td>
    </tr>
    <tr>
      <td align="left" valign="top" class="color_606060">&nbsp;</td>
      <td colspan="3" align="left" valign="top">&nbsp;</td>
    </tr>
    <tr>
      <td width="20" align="left" valign="top" class="color_606060">&nbsp;</td>
      <td width="30%" align="left" valign="top">Tarikh Lahir </td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="pribadi[tarikh_lahir]" id="tarikh_lahir" value="<?=dmy_date($pribadi->tarikh_lahir)?>" onblur="" onchange="" onselect="" maxlength="20" size="12" type="text" readonly="readonly" onfocus="alert('Sila klik pada (dd-mm-yyyy) di sebelah')"/>
        <span style=" font-size:0.8em; color: orange;">(<a id="tarikh_lahir_trigger">dd-mm-yyyy</a>)</span>
        <!--button id="f_clearRangeStart" onclick="clearRangeStart()">clear</button-->
        <script type="text/javascript">
                  new Calendar({
                          inputField: "tarikh_lahir",
                          dateFormat: "%d-%m-%Y",
                          trigger: "tarikh_lahir_trigger",
                          bottomBar: false,
                          onSelect: function() {
                                  var date = Calendar.intToDate(this.selection.get());
                                  LEFT_CAL.args.min = date;
                                  LEFT_CAL.redraw();
                                  this.hide();
                          }
                  });
                  function clearRangeStart() {
                          document.getElementById("tarikh_lahir").value = "";
                          LEFT_CAL.args.min = null;
                          LEFT_CAL.redraw();
                  };
                </script>
</span></td>
    </tr>
    
    <tr>
      <td width="20" align="left" valign="top" class="color_606060">&nbsp;</td>
      <td width="30%" align="left" valign="top">No Telefon </td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="pribadi[no_tel]" id="no_tel" value="<?=$pribadi->no_tel?>" onblur="" onchange="" onfocus="" onselect="" maxlength="20" size="12" type="text"/>
      </span></td>
    </tr>
    
    <tr>
      <td valign="top" align="left" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">Alamat Rumah</td>
      <td width="30" valign="top">:</td>
      <td><div style=" margin-bottom:3px;">
        <input name="pribadi[address1]" id="address1" value="<?=$pribadi->address1?>" onblur="" onchange="" onfocus="" onselect="" maxlength="90" size="50" type="text" />
      </div>
        <div style=" margin-bottom:3px;">
          <input name="pribadi[address2]" id="address2" value="<?=$pribadi->address2?>" onblur="" onchange="" onfocus="" onselect="" maxlength="90" size="50" type="text" />
        </div>      </td>
    </tr>
    <tr>
      <td valign="top" align="left" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">Poskod</td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="pribadi[poskod]" id="poskod" value="<?=sprintf("%05d",$pribadi->poskod)?>" onblur="" onchange="" onfocus="" onselect="" maxlength="5" size="5" type="text" />
      </span></td>
    </tr>
    <tr>
      <td valign="top" align="left" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">Bandar</td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="pribadi[bandar]" id="bandar" value="<?=$pribadi->bandar?>" onblur="" onchange="//this.value=this.value.toUpperCase()" onfocus="" onselect="" maxlength="100" size="50" type="text"/>
      </span></td>
    </tr>
    <tr>
      <td valign="top" align="left" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">Negeri</td>
      <td width="30">:</td>
      <td><span class="classRow">
        <select name="pribadi[negeri]" id="negeri" onchange="">
          <?
				$combo   = new GUI();
				//$options = getOptionsFromTable('ref_negeri','id','negeri');
				$options = getOptionsFromTable('negeri','negeri','negeri');
				echo $combo->printCombo2($options, "",true, $pribadi->negeri, false,0);
			  ?>
        </select>
      </span></td>
    </tr>
    <tr>
      <td valign="top" align="left" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">&nbsp;</td>
      <td width="30">&nbsp;</td>
      <td></td>
    </tr>
    <tr>
      <td valign="top" align="left" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">Warganegara</td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="pribadi[warganegara]" id="warganegara" value="<? echo ($pribadi->warganegara!='')? $pribadi->warganegara:"Malaysia";?>" onblur="" onchange="" onfocus="" onselect="" maxlength="20" size="20" type="text"/>
      </span></td>
    </tr>
    <tr>
      <td valign="top" align="left" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">Bangsa</td>
      <td width="30">:</td>
      <td><span class="classRow">
        <select name="pribadi[bangsa]" id="bangsa" onchange="">
          <?
				$default_bangsa = ($pribadi->bangsa) ? $pribadi->bangsa : 'Melayu';
				$combo   = new GUI();
				//$options = getOptionsFromTable('ref_negeri','id','negeri');
				$options = getOptionsFromTable('bangsa','bangsa','bangsa');
				echo $combo->printCombo2($options, "",true, $default_bangsa, false,0);
			  ?>
        </select>
      </span></td>
    </tr>
    <tr>
      <td valign="top" align="left" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">Jantina</td>
      <td width="30">:</td>
      <td><span class="classRow">
        <select name="pribadi[jantina]" id="jantina" onchange="">
          <?
				$combo   = new GUI();
				//$options = getOptionsFromTable('ref_negeri','id','negeri');
				$options = getOptionsFromTable('jantina','jantina','jantina');
				echo $combo->printCombo2($options, "",true, $pribadi->jantina, false,0);
			  ?>
        </select>
      </span></td>
    </tr>
    <tr>
      <td valign="top" align="left" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">Status Perkahwinan </td>
      <td width="30">:</td>
      <td><span class="classRow">
        <select name="pribadi[status]" id="status" onchange="">
          <?
				$combo   = new GUI();
				//$options = getOptionsFromTable('ref_negeri','id','negeri');
				$options = getOptionsFromTable('pribadi','status','status');
				echo $combo->printCombo2($options, "",true, $pribadi->status, false,0);
			  ?>
        </select>
      </span></td>
    </tr>
  </tbody>
</table>
</fieldset>
<br/>
<fieldset style="background:#ffffff; border-width:thin; border-style:solid; padding:10px; border-color:#CCCCCC;">
<legend style="font-size:1.0em; font-weight: bold;">Maklumat Perkhidmatan </legend>
<table width="100%" cellspacing="1" cellpadding="2" border="0" class="classBackground">
  <tbody>
    <tr>
      <td width="20" align="left" valign="top" class="color_606060">&nbsp;</td>
      <td width="30%" align="left" valign="top">Jawatan</td>
      <td width="30">:</td>
      <td><span class="classRow">
        <select name="khidmat[jawatan_id]" id="jawatan_id" onchange="">
          <?
				$combo   = new GUI();
				//$options = getOptionsFromTable('ref_negeri','id','negeri');
				$options = getOptionsFromTable('jawatan','kod_jawatan','jawatan');
				echo $combo->printCombo2($options, "",true, $khidmat->jawatan_id, false,0);
			  ?>
        </select>
      </span></td>
    </tr>
    <tr>
      <td width="20" align="left" valign="top" class="color_606060">&nbsp;</td>
      <td width="30%" align="left" valign="top">No Gaji </td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="khidmat[no_gaji]" id="no_gaji" value="<?=$khidmat->no_gaji?>" onblur="" onchange="" onfocus="" onselect="" maxlength="20" size="20" type="text"/>
      </span></td>
    </tr>
    <tr>
      <td width="20" align="left" valign="top" class="color_606060">&nbsp;</td>
      <td width="30%" align="left" valign="top">Gaji</td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="khidmat[gaji]" id="gaji" value="<?=$khidmat->gaji?>" onblur="" onchange="" onfocus="" onselect="" maxlength="20" size="20" type="text"/>
      </span></td>
    </tr>
    <tr>
      <td width="20" align="left" valign="top" class="color_606060">&nbsp;</td>
      <td width="30%" align="left" valign="top">No Telefon </td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="khidmat[telefon]" id="telefon" value="<?=$khidmat->telefon?>" onblur="" onchange="" onfocus="" onselect="" maxlength="20" size="20" type="text"/>
      </span></td>
    </tr>
    <tr>
      <td width="20" align="left" valign="top" class="color_606060">&nbsp;</td>
      <td width="30%" align="left" valign="top">Cawangan</td>
      <td width="30">:</td>
<script>
function getCawanganInfo() {
	//$('item_selection').innerHTML = "<font color=orange>Searching Items...please wait</font>"
	ajax_cawangan_request("ajax.php?act=get_cawangan_info", "cawangan_id="+$("cawangan_id").value)
}

function ajax_cawangan_request(url, data) {
    var myAjax = new Ajax.Request(
        url,
        {method: 'post', parameters: data, onComplete: ajax_cawangan_response}
    );
}

function ajax_cawangan_response(originalRequest) {
	if (originalRequest.responseText != 0) {
		var a = originalRequest.responseText.split("--%%--")
		var k = new Array(a.length)
		for (i=0; i<k.length; i++) {
			k[i] = a[i].split("=")
		}
		//alert(originalRequest.responseText)
		$('alamat1').value = a[0]
		$('alamat2').value = a[1]
		$('khidmat_poskod').value = a[2]
		$('khidmat_bandar').value = a[3]
		
	}
	else {
		$('select_cawangan_span').innerHTML = "<font color=orange>Cawangan tidak dijumpai</font>"
	}
}
</script>


      <td>
        <select name="khidmat[cawangan_id]" id="cawangan_id" onchange="getCawanganInfo()">
          <?
				$combo   = new GUI();
				$options = getOptionsFromTable('cawangan','id_cawangan','cawangan');
				echo $combo->printCombo2($options, "",true, $khidmat->cawangan_id, false,0);
			  ?>
        </select>
      <span id="select_cawangan_span"></span></td>
    </tr>
    <tr>
      <td width="20" align="left" valign="top" class="color_606060">&nbsp;</td>
      <td width="30%" align="left" valign="top">Alamat</td>
      <td width="30">:</td>
      <td><div style=" margin-bottom:3px;">
          <input name="khidmat[alamat1]" id="alamat1" value="<?=$khidmat->alamat1?>" onblur="" onchange="" onfocus="" onselect="" maxlength="90" size="50" type="text"  readonly />
        </div>
        <div style=" margin-bottom:3px;">
          <input name="khidmat[alamat2]" id="alamat2" value="<?=$khidmat->alamat2?>" onblur="" onchange="" onfocus="" onselect="" maxlength="90" size="50" type="text" readonly/>
        </div></td>
    </tr>
    <tr>
      <td align="left" valign="top" class="color_606060">&nbsp;</td>
      <td align="left" valign="top">Poskod</td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="khidmat[poskod]" id="khidmat_poskod" value="<?=sprintf("%05d",$khidmat->poskod)?>" onblur="" onchange="" onfocus="" onselect="" maxlength="5" size="5" type="text" readonly/>
      </span></td>
    </tr>
    <tr>
      <td valign="top" align="left" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">Bandar</td>
      <td width="30">:</td>
      <td><span class="classRow">
        <input name="khidmat[bandar]" id="khidmat_bandar" value="<?=$khidmat->bandar?>" onblur="" onchange="//this.value=this.value.toUpperCase()" onfocus="" onselect="" maxlength="100" size="50" type="text" readonly/>
      </span></td>
    </tr>
    <tr>
      <td valign="top" align="left" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">Email</td>
      <td>:</td>
      <td><span class="classRow">
        <input name="khidmat[email]" id="khidmat_email" value="<?=$khidmat->email?>" onblur="" onchange="//this.value=this.value.toUpperCase()" onfocus="" onselect="" maxlength="50" size="50" type="text"/>
      </span></td>
    </tr>
  </tbody>
</table>
</fieldset>
<br />
<br />
<fieldset style="background:#ffffff; border-width:thin; border-style:solid; padding:10px; border-color:#CCCCCC;">
<legend style="font-size:1.0em; font-weight: bold;">Maklumat Penama </legend>
<table width="100%" cellspacing="1" cellpadding="2" border="0" class="classBackground">
  <tbody>
    <tr>
      <td width="20" align="left" valign="top" class="color_606060">&nbsp;</td>
      <td width="30%" align="left" valign="top">Nama</td>
      <td width="20">:</td>
      <td><span class="classRow">
        <input name="penama[waris]" id="waris" value="<?=$penama->waris?>" onblur="" onchange="//this.value=this.value.toUpperCase()" onfocus="" onselect="" maxlength="100" size="50" type="text"/>
      </span></td>
    </tr>
    <tr>
      <td valign="top" align="left" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">No. KP Baru </td>
      <td>:</td>
      <td><span class="classRow">
        <input name="penama[nokp_baru]" id="penama_nokp_baru" value="<?=$penama->nokp_baru?>" onblur="" onchange="" onfocus="" onselect="" maxlength="14" size="14" type="text"/>
      </span></td>
    </tr>
    <tr>
      <td valign="top" align="left" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">No. KP Lama </td>
      <td>:</td>
      <td><span class="classRow">
        <input name="penama[nokp_lama]" id="penama_nokp_lama" value="<?=$penama->nokp_lama?>" onblur="" onchange="" onfocus="" onselect="" maxlength="14" size="14" type="text"/>
      </span></td>
    </tr>
    <tr>
      <td valign="top" align="left" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">No. Sijil Lahir </td>
      <td>:</td>
      <td><span class="classRow">
        <input name="penama[no_daftar_lahir]" id="no_daftar_lahir" value="<?=$penama->no_daftar_lahir?>" onblur="" onchange="" onfocus="" onselect="" maxlength="14" size="14" type="text"/>
      </span></td>
    </tr>
    <tr>
      <td valign="top" align="left" class="color_606060">&nbsp;</td>
      <td valign="top" align="left">Hubungan</td>
      <td>:</td>
      <td><span class="classRow">
        <select name="penama[hubungan]" id="hubungan" onchange="">
          <?
				$combo   = new GUI();
				$options = getOptionsFromTable('penama','hubungan','hubungan');
				echo $combo->printCombo2($options, "",true, $penama->hubungan, false,0);
			  ?>
        </select>
      </span></td>
    </tr>
  <tr>
    <td></tbody></td>
  </tr>
</table>
</fieldset>
<br>
<center>
<br/>
<span class="TableRowLeft">
<input name="button233" type="submit" class="Button" onclick="" value="Simpan" style=" width:100px;" />
</span>
<span class="TableRowLeft">
<input name="button2322" type="button" class="Button" onclick="history.back();" value="Batal" style=" width:100px;" />
</span>
</center>

<script>

function GoSubmit(df) {

	//if (!checkSelection(strRegExp,$('kod'),'Kod Institusi')) return false;
	if (!checkInput(/.*/,$('master_profil_nama'),'Nama Murid')) return false;

<? if ($_REQUEST['jenis_dokumen'] == '1') {?>
	if (!checkInput(icnumRegExp,$('master_profile_no_kp'),'No. MyKid')) return false;
<? } ?>
<? if ($_REQUEST['jenis_dokumen'] == '2') {?>
	if (!checkInput(/.*/,$('master_profile_no_surat_beranak'),'No. Surat Beranak')) return false;
<? } ?>
<? if ($_REQUEST['jenis_dokumen'] == '3') {?>
	if (!checkInput(/.*/,$('master_profile_no_passport'),'No. Passport')) return false;
<? } ?>

	if (!checkInput(/.*/,$('f_rangeStart'),'Tarikh Lahir')) return false;
	//if (!checkRadio(/.*/,$('jantina'),'Jantina')) return false;
	var $jantina_checked = false;
	if ( $('kod_jantina_L').checked || $('kod_jantina_P').checked ) {
		$jantina_checked = true;
	}
	if (!$jantina_checked) {
		alert("Sila pilih jantina.");
		$('kod_jantina_L').style.color='red';
		$('kod_jantina_L').focus();
		return false;
	}
	
	if (!checkSelection(/.*/,$('master_profile_agama_id'),'Agama')) return false;
	if (!checkSelection(/.*/,$('master_profile_kod_kaum'),'Keturunan')) return false;	
	if (!checkSelection(/.*/,$('master_profil_negeri_kelahiran_id'),'Negeri Kelahiran')) return false;


	//if (!checkRadio(/.*/,$('warga'),'Warganegara')) return false;
	var $warganegara_checked = false;
	if ( $('warga_W').checked || $('warga_B').checked ) {
		$warganegara_checked = true;
	}
	if (!$warganegara_checked) {
		alert("Sila pilih taraf warganegara.");
		$('warga_W').style.color='red';
		$('warga_W').focus();
		return false;
	}
	
	if (!checkInput(/.*/,$('master_alamat_alamat1'),'Alamat')) return false;
	
	if (!checkInput(postcodeRegExp,$('master_alamat_poskod'),'Poskod')) return false;
	if (!checkInput(/.*/,$('bandar'),'Bandar')) return false;
	if (!checkSelection(/.*/,$('master_alamat_negeri_id'),'Negeri')) return false;	
	if (!checkRadio(strRegExp,$('status_murid'),'Status Murid')) return false;	
	
	if (!checkSelection(/.*/,$('murid_maklumat_oku_id'),'Maklumat OKU')) return false;	

	// maklumat penjaga
	if (!checkInput(/.*/,$('profile_bapa_nama'),'Nama Bapa')) return false;
	if (!checkInput(/.*/,$('profile_bapa_no_kp'),'No. Kad Pengenalan/Passport Bapa')) return false;
	if (!checkInput(/.*/,$('bapa_kerja_id'),'Pekerjaan')) return false;
	if (!checkInput(numRegExp,$('bapa_pendapatan'),'Pendapatan(RM)')) return false;
	if (!checkRadio(/.*/,$('warga_bapa'),'Taraf Warganegara Bapa')) return false;	
	
	// ibu
	if (!checkInput(/.*/,$('profile_ibu_nama'),'Nama Ibu')) return false;
	if (!checkInput(/.*/,$('profile_ibu_no_kp'),'No. Kad Pengenalan/Passport Ibu')) return false;
	if (!checkInput(/.*/,$('ibu_kerja_id'),'Pekerjaan Ibu')) return false;
	if (!checkInput(numRegExp,$('ibu_pendapatan'),'Pendapatan(RM) Ibu')) return false;
	if (!checkRadio(/.*/,$('warga_ibu'),'Taraf Warganegara Ibu')) return false;	
	

	//if (!checkInput(anythingRegExp,$('profile_name'),'Nama Penuh Pemohon')) return false;
	//if (!checkInput(anything,$('profile_fax'),'Nombor Fax')) return false;

	return true;
}

function validate(evt) {
  var theEvent = evt || window.event;
  var key = theEvent.keyCode || theEvent.which;
  key = String.fromCharCode( key );
  var regex = /[0-9]|[\b]/;
  if( !regex.test(key) ) {
    theEvent.returnValue = false;
    theEvent.preventDefault();
  }
}




// kira check julat pendapatan
function kiraJulatPendapatan(pendapatan, targetId){
	var el = document.getElementById(targetId);
	pendapatan = parseInt(pendapatan);
	var checkThis = /\d+/g;
	var checkThisLess = /</g;
	var checkThisMore = />/g;
	var limit_arr = new Array();
	selected_val = 0;
	for(var i=1; i<el.length; i++){
		var opt_val = el.options[i].value;
		var opt_text = el.options[i].text;

		if(a = opt_text.match(checkThis)){
			if(a.length == 1){
				if(opt_text.match(checkThisLess)){ // < value ; 0 ~ value
					limit_arr[opt_val] = parseInt(a[0]);
 					if(pendapatan <= parseInt(a[0])){
						selected_val = opt_val;
						break; 
					}
				}
				if(opt_text.match(checkThisMore)){ // > value ; value ~ inf
					limit_arr[opt_val] = 99999999;
 					if(pendapatan >= parseInt(a[0])){
						selected_val = opt_val;
						break; 
					}
				}
			}
			
			if(a.length == 2){ // ada range 
				limit_arr[opt_val] = a[1];
 				if(pendapatan <= parseInt(a[1])){
					selected_val = opt_val;
					break;
				}
			}
		}
	}
	return el.selectedIndex = selected_val;
}

</script>

          <div id="cont" style=" display:none"></div>
          <script type="text/javascript">
            var LEFT_CAL = Calendar.setup({
                    cont: "cont",
                    weekNumbers: true,
                    selectionType: Calendar.SEL_MULTIPLE,
                    showTime: 12
                    // titleFormat: "%B %Y"
            })
          </script>


